package com.calligraphy.order.message;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * @Author hy
 * @Date 2019/1/2 15:34
 **/
@Component
@Slf4j
public class MqReceiver {

   /*
    * 手动创建队列
    @RabbitListener(queues = "myQueue")
    public void process(String msg){
        log.info("msg="+msg);
    }*/

    /**
     * key : 类型
     * @param msg
     */
   @RabbitListener(bindings = @QueueBinding(
            key = "myKey",
            exchange = @Exchange("myOrder"),
            value = @Queue("myQueue")
    ))
    public void process(String msg){
        log.info("【msg={}】"+msg);
    }
}
